
#include "camera.h"

USING_NAMESPACE_OXGE

Camera& Camera::SetUpDir( const Vector3& dir )
{
	m_upDir = dir;
	return *this;
}

Camera::Camera()
{
	m_vPosition = Point3::ZERO;
	m_vFocusPoint = Point3::ZERO - Vector3::UNIT_Z;
	m_upDir = Vector3::UNIT_Y;

	m_dNear = 1;
	m_dFar  = 100;
	m_dfovy = 30;
	m_aspectRatio = 1;
}

Camera& Camera::Transform( const Transformation3D& transf)
{
	m_vFocusPoint = transf(m_vFocusPoint);
	m_upDir = transf(m_vPosition + m_upDir) - transf(m_vPosition);	
	m_vPosition = transf(m_vPosition);
	return *this;
}

Camera& oxge::Camera::Set( const Point3& pos, const Point3& lookPt, const Vector3& upDir )
{
	m_vPosition = pos;
	m_vFocusPoint = lookPt;
	m_upDir = upDir;
	return *this;
}